package com.snake.controllers;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.apache.log4j.Logger;

import com.snake.models.PermissionUser;
import com.snake.repositories.PermissionUserService;

/**
 * Created by zhaohaochen on 2016/12/26.
 */
@RestController
@RequestMapping(value = "/api/method/user")
public class UserController extends BaseController{
	public static Logger logger = Logger.getLogger(UserController.class
			.getName());
	@Autowired
	private PermissionUserService permissionUserService;
	@RequestMapping(value = "/{id}", method = RequestMethod.GET)
	public Map<String, Object> getById(@PathVariable(value = "id") Integer id) {
		PermissionUser permissionUser = permissionUserService.getById(id);
		if (permissionUser == null) {
			return getReturnMapFailure();
		}
		return getReturnMapSuccess(permissionUser);
	}
	 
}